# Contributor: Eloi Torrents <eloitor@disroot.org>
# Maintainer: Eloi Torrents <eloitor@disroot.org>
pkgname=osmin
pkgver=1.12.2
pkgrel=0
pkgdesc="GPS Navigator On-Road/Off-Road"
url="https://github.com/janbar/osmin"
arch="all !armhf !s390x"
# armhf: qt5-qtsensors-dev, qt5-qtlocation-dev
# s390x: openmp-dev
license="GPL-3.0-only"
makedepends="
	clang
	cmake
	doxygen
	gnu-libiconv-dev
	libmarisa-dev
	libxml2-dev
	openmp-dev
	qt5-qtbase-dev
	qt5-qtdeclarative-dev
	qt5-qtsvg-dev
	qt5-qtquickcontrols2-dev
	qt5-qtsensors-dev
	qt5-qtmultimedia-dev
	qt5-qtremoteobjects-dev
	qt5-qtlocation-dev
	samurai
	"
options="!check" # no test suite
source="$pkgname-$pkgver.tar.gz::https://github.com/janbar/osmin/archive/refs/tags/$pkgver.tar.gz
	$pkgname-osmscout-$pkgver.tar.gz::https://github.com/janbar/libosmscout/archive/refs/tags/osmin-$pkgver.tar.gz
	system-libmarisa.patch
	"

prepare() {
	rmdir backend/libosmscout
	mv -v ../libosmscout-$pkgname-$pkgver backend/libosmscout
	default_prepare
}

build() {
	CFLAGS="$CFLAGS -I/usr/include/gnu-libiconv" \
	CXXFLAGS="$CXXFLAGS -I/usr/include/gnu-libiconv" \
	LDFLAGS="$LDFLAGS -liconv" \
	cmake -B build -G Ninja -Wno-dev \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_C_COMPILER=clang \
		-DCMAKE_CXX_COMPILER=clang++ \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_DEPENDENCIES=OFF \
		-DBUILD_DEVICEMOBILE=ON
	cmake --build build
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
c0b8ff9072ec634664e7c309b496e3ca1ce3320e48aa86bbd293d2f6d0fcef63b40222410b5d8565f49eb5620e55dbb92116c774548ce7e854c7511e0311dce8  osmin-1.12.2.tar.gz
55f5eb4d2e1fd61532b79ba037ca39274354988e71dae82c101466e1f6e030b32a438da12d20d9bedbd7e0427b1982db979ee63929a7820cc93cb1990f5f39b6  osmin-osmscout-1.12.2.tar.gz
034ac53631e1ba1dc8e6af4727664584e4adb015573ae632aaf12d73ea2b0eab1526b93a25c63cda497aec91486ec4cfe6ba0e9aa97227b59a168411b7dee5c7  system-libmarisa.patch
"
